use std::env;
use std::fs::File;
use std::io::Read;
use std::path::Path;

fn main() -> std::io::Result<()> {
    println!("Hello, world!");

    env::set_current_dir(Path::new(".")).unwrap();
    match env::current_dir() {
        Ok(current_dir) => {
            println!("Current directory: {:?}", current_dir);
        }
        Err(e) => {
            eprintln!("Error: {}", e);
        }
    }

    // 读取配置文件
    let mut file = File::open("config.txt")?;
    let mut contents = String::new();
    file.read_to_string(&mut contents)?;

    // 处理配置
    println!("配置内容：{}", contents);

    Ok(())
}
